#pragma once
#include "logic.h"

namespace KeyAss 
{
	typedef void SetText(const std::string& key);
	typedef const std::string& GetText();
	typedef void PauseResume();

	class LOGIC_API XchangeKey
	{
		friend class HookKeyClass;
	private:
		bool _pause;
		HookKeyClass* _pHook;
		SetText* _SetTextFunc;
		GetText* _GetTextFunc;
		PauseResume* _PauseFunc;
		void UISet(const std::string&);
		const std::string& UIGet();
		void AppPauseResume();
	private:
		HWND _hwnd;
		void InitBuffer();
		void FinishInput(DWORD vk, char last);
		BYTE GetShift();
		BYTE GetCap();
		const std::string& GetBuffer();
	public:
		void ReloadCfg();
		void Pause(){_pause = true;}
		void Resume(){_pause = false;}
		bool Paused(){return _pause;}
		XchangeKey(SetText st, GetText gt, PauseResume pr, HWND hwnd);
		~XchangeKey(void);
		void Start();
		void Stop();
	};

}